<?php namespace Common\Model;
use Hdphp\Model\Model;
class Bgoods extends Model{
	  protected $table = "bgoods";
	//自动验证

	 protected $validate = array( 

	    
	);
	public function store(){
//	    if(!$this->create()) return false;
		//接受数据
		$formData=Q('post.');
		$form=Q('post.');
		$form['bbid']=implode(',', $form['bbid']);
//		$this->add($formData);
		//处理数据
		//添加数据
		$formData['bid']=$this->add($form);
		//查找数据
		//商品属性表
		$this->gamodel=new \Common\Model\Gevalue;
		foreach ($formData['bbid'] as $k =>$v) {
			if($v!=''){
			$formData['bbid'][$k]=$this->gamodel->where("gaid={$v}")->pluck('gtvalue');
			}
		}
		return $formData;
	}
	
	//编辑验证
	public function edit(){
	    if(!$this->create()) return false;
		$this->data['bbid']=implode(',', $this->data['bbid']);
		$this->save();
		return true;
	}
	
}
 ?>